package com.gopay.scheduler.service.fund.impl;

import com.gopay.common.constants.proccode.ProcCodeConstants;
import com.gopay.common.domain.cps.transfer.Tran02016VO;
import com.gopay.common.domain.cps.vo.CPSResponse;
import com.gopay.cron.web.util.CallCPSUtil;
import com.gopay.scheduler.service.fund.FundPayOrderService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;


@Service(value = "fundPayOrderService")
public class FundPayOrderServiceImpl implements FundPayOrderService {
    protected Logger logger = Logger.getLogger(getClass());

    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = { Exception.class })
    public Boolean createAllOrders(Tran02016VO pay){
        Boolean flag = true;

        try {
            CPSResponse res =  CallCPSUtil.callByVOTicket(pay);
            if (!ProcCodeConstants.PROC_CODE_100S1000.equals(res.getRespCode())) {
                flag = false;
            }

        } catch (Exception e) {
            flag = false;
            e.printStackTrace();
        }

        return flag;
    }



}
